home *** CD-ROM | disk | FTP | other *** search
/ Trading on the Edge / Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin / pc / mac_file / vendor_d / ga_softw / ooga / ga-meth.lis < prev    next >
File List  |  1991-02-03  |  2KB  |  71 lines

  1. ;;; -*- Mode:Lisp; Package:OOGA; Base:10; Syntax:COMMON-LISP -*-
  2. #||
  3.             RESTRICTED RIGHTS LEGEND
  4.                     
  5.  Use, duplication, or disclosure by the Government is subject to
  6.  restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
  7.  Technical Data and Computer Software Clause at 52.227-7013 of the DOD
  8.  FAR Supplement.
  9.                     
  10.                 TSP (The Software Partnership)
  11.                 P.O. Box 991
  12.                 Melrose, MA 02176
  13.                     
  14.       Copyright 1990 by Lawrence Davis and Daniel Cerys, all rights reserved.
  15. ||#
  16.  
  17. (in-package :ooga)
  18.  
  19.  
  20. ;************************************************************
  21.  
  22. ;    GENETIC ALGORTHM
  23.  
  24.  
  25. ;;; RUN is the top-level driver.  It calls the initialization
  26. ;;; processes, drives the initialization of the population,
  27. ;;; drives the evolution process, and carries out final
  28. ;;; processing.
  29.  
  30. (defmethod RUN ((ga basic-genetic-algorithm))
  31.   "Top-level loop to drive the genetic process."
  32.   (initialize-for-run ga)
  33.   (initialize-population (population-module ga))
  34.   (evolve (population-module ga))
  35.   (terminate-run ga))
  36.  
  37.  
  38. (defmethod INITIALIZE-FOR-RUN ((ga basic-genetic-algorithm))
  39.   "Set up the GA for a run."
  40.   (setf (ga (population-module ga)) ga
  41.     (ga (reproduction-module ga)) ga
  42.     (ga (evaluation-module ga)) ga)
  43.   (initialize-for-run (population-module ga))
  44.   (initialize-for-run (reproduction-module ga))
  45.   (initialize-for-run (evaluation-module ga)))
  46.  
  47.  
  48.  
  49.  
  50. ;;; The TERMINATE-RUN processes are no ops.  They are provided
  51. ;;; as hooks for user-defined methods.
  52.  
  53. (defmethod TERMINATE-RUN ((ga basic-genetic-algorithm))
  54.   "Carry out post-processing."
  55.   (terminate-run (population-module ga))
  56.   (terminate-run (reproduction-module ga))
  57.   (terminate-run (evaluation-module ga)))
  58.  
  59.  
  60. (defmethod TERMINATE-RUN ((module basic-population-module))
  61.   t)
  62.  
  63.  
  64. (defmethod TERMINATE-RUN ((module basic-reproduction-module))
  65.   t)
  66.  
  67.  
  68. (defmethod TERMINATE-RUN ((module basic-evaluation-module))
  69.   t)
  70.  
  71.